package main;

import java.util.Objects;
import java.util.Scanner;

abstract class Express{
    int weight;
    int getWeight(){
        return weight;
    }
    abstract int getTotal(int weight);
}

class SLExpress extends Express{

    int  getTotal(int weight){
        if(weight > 1){
            return 12 + (weight - 1) * 2;
        }
        else
            return 12;
    }
}

class DDExpress extends Express{

    int  getTotal(int weight){
        if(weight > 1){
            return 5 + (weight - 1);
        }
        else
            return 5;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        int N = reader.nextInt();
        String []name = new String[N];
        int []weight = new int[N];

        for(int i=0;i<N;i++){
            name[i] = reader.next();
            weight[i] = reader.nextInt();
        }

        for(int k=0;k<N;k++){
            if(Objects.equals(name[k], "SL")) {
                SLExpress sl = new SLExpress();
                System.out.println("SLExpress:"+sl.getTotal(weight[k]));
            }
            if(Objects.equals(name[k], "DD")){
                DDExpress dd = new DDExpress();
                System.out.println("DDExpress:"+dd.getTotal(weight[k]));
            }
        }

    }
}
